/**
 * 主路由
 * @description 管理登录，404路由
 */
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from "@angular/router";
import {LoginComponent} from './login/login/login.component';
import {PageNotFoundComponent} from './page-not-found/page-not-found.component';
import {ChooseShopComponent} from "./login/choose-shop/choose-shop.component";
import {GetBackPwdComponent} from "./login/get-back-pwd/get-back-pwd.component";
import {IndexDataGuard} from "./main/grauds/index-data.guard";
import {MainGuard} from "./main/grauds/main.guard";
import {LoginGuard} from "./login/grauds/login.guard";
import {GetBackPwd2Component} from "./login/get-back-pwd2/get-back-pwd2.component";


let AppRoutings: Routes = [
  {path: 'login', component: LoginComponent, canActivate:[LoginGuard]} // 登录
  , {path: 'choose-shop', component: ChooseShopComponent, canActivate: [LoginGuard]} // 选择商户
  , {path: 'get-back-pwd', component: GetBackPwdComponent} // 找回密码第一步
  , {path: 'get-back-pwd2', component: GetBackPwd2Component} // 找回密码第二步
  , {path: 'main', loadChildren: './main/main.module#MainModule', canActivate:[MainGuard], data: {r: true}} // 主功能
  , {path: '', redirectTo: 'login', pathMatch: 'full'}
  , {path: '**', component: PageNotFoundComponent}
];

@NgModule({
  imports: [RouterModule.forRoot(AppRoutings)],
  exports: [RouterModule]
})
export class AppRoutingModule{}
